/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N000;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class N000Store extends N000 {

    public int updateN000(int pnPN000, int pnFH000, int pnFH200,String pvNV001, String pvNV002, String pvNV003, String pvNV004, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N000, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN000),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.CHAR, pvNV001),
                        new Param(OracleTypes.CHAR, pvNV002),
                        new Param(OracleTypes.CHAR, pvNV003),
                        new Param(OracleTypes.CHAR, pvNV004),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, N000.class);
        } catch (SQLException ex) {
            Logger.getLogger(N000Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

     public List<N000> getListN000(int pnFH000, int pnFH200, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N000, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, N000.class);
    }
     
      public List<N000> findAllN850ForCombo(int pnFH000, int pnFH200,String pvNV004, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMB_N000, OracleTypes.CURSOR, new Param[]{
                       new Param(OracleTypes.INTEGER, pnFH000),
                       new Param(OracleTypes.INTEGER, pnFH200),
                       new Param(OracleTypes.CHAR, pvNV004),
                       new Param(OracleTypes.CHAR, pvLOGIN)
                   });
           return super.find(dataStatement, N000.class);
        } catch (SQLException ex) {
            Logger.getLogger(N000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N000Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
      
      public int deleteN000(int pnPN000, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N000, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN000),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, N000.class);
        } catch (SQLException ex) {
            Logger.getLogger(N000Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
    
    
}
